/**
 * @file
 * @author  Tsin Smith <tsin.creator@gmail.com>
 *
 * @description
 * Acknowledgement: Thinking In C++ Vol.2 by Bruce Eckel and Chuck Allison
 *
 */


#ifndef __TSIN_UTIL_MEMCHECK_HPP__
#define __TSIN_UTIL_MEMCHECK_HPP__

#ifdef TSIN_MEMCHECK

#include <tsin/util/common.hpp>
#include <cstddef>

UTIL_DLLEXPORT void *operator new(std::size_t, const char *, long);
UTIL_DLLEXPORT void *operator new[](std::size_t, const char *, long);
#define new new (__FILE__, __LINE__)

void operator delete(void *);
void operator delete(void *, const char *, long);
void operator delete[](void *);
void operator delete[](void *, const char *, long);

extern UTIL_DLLEXPORT bool traceFlag;
#define TRACE_ON() traceFlag = true
#define TRACE_OFF() traceFlag = false

extern UTIL_DLLEXPORT bool activeFlag;
#define MEM_ON() activeFlag = true
#define MEM_OFF() activeFlag = false

#else

#define TRACE_ON()
#define TRACE_OFF()
#define MEM_ON()
#define MEM_OFF()

#endif /* TSIN_MEMCHECK */

#endif /* __TSIN_UTIL_MEMCHECK_HPP__ */
